﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<MethodWorx.CMS.UI.Areas.Application.Models.CreateContentItemModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script language="javascript">
        $(document).ready(function () { $("#cancel").click(function () { window.parent.closeDialog(); }) });
    </script>

    <%using (Html.BeginForm("CreateContent", "CreateContentItem", new { id = this.Model.Request.ParentPage != null ? this.Model.Request.ParentPage.Id.ToString() : "" }))
      { %>
    <%=Html.HiddenFor(m => m.Request.ExistingContentTemplate)%>
    <%=Html.HiddenFor(m => m.Request.NewTemplateName)%>
    <%=Html.HiddenFor(m => m.Request.MinimumRequired)%>
    <%=Html.HiddenFor(m => m.Request.MaximumAllowed)%>
    <%if (this.Model.Request.ParentPage != null)
      { %>
    <div class="formItem">
        <label>Parent Page:</label> <%=this.Model.Request.ParentPage.Name%> (<%=this.Model.Request.ParentPage.Template.Name%>)
    </div>
    <%} %>
    <div class="formItem">
        <label>Template:</label>
        <%if (this.Model.Request.ExistingContentTemplate != null)
          {%>
          <%=this.Model.Request.ExistingContentTemplate.Name%> (Existing Template)
        <%}
          else
          { %>
        <%=this.Model.Request.NewTemplateName%> (New Template)
        <%} %>
    </div>
    <div class="formItem">
        <label>Content Name</label>
        <%=Html.TextBoxFor(m => m.Request.ContentName)%><br />
        <%=Html.ValidationMessageFor(m => m.Request.ContentName)%>
    </div>
    <%if(this.Model.Request.MinimumRequired.HasValue && !string.IsNullOrEmpty(this.Model.Request.NewTemplateName)){ %>
    <div class="formItem">
        <label>Create All Required</label>
        <%=Html.CheckBoxFor(m => m.Request.CreateAllRequired) %> (Will create <%:this.Model.Request.MinimumRequired %> content items)</br>
        <%=Html.ValidationMessageFor(m => m.Request.CreateAllRequired)%>
    </div>
    <%} %>
    <div class="formItem">
        <button>Finish</button>
        <button id="cancel" type="button">Cancel</button>
    </div>
    <%} %>

</asp:Content>
